<?xml version="1.0" ?>

<xsl:stylesheet   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
						xmlns:lzc="http://schemas.icitadel.com/Lazarus/Compiled.xsd"
                  version="1.0">

   <xsl:output method="text"/>

	<xsl:include href="../../common.xsl" />
	<xsl:include href="../../convert.xsl" />
   
   <xsl:template match="lzc:project">
		<xsl:apply-templates select="lzc:tables/lzc:table[ ( @compiling ) ]" />
	</xsl:template>

   <xsl:template match="lzc:table[ @compiling ]">
			<xsl:variable name="v_XmlNamespace">lz:</xsl:variable>
			<xsl:variable name="v_ObjectName">
				<xsl:value-of select="@name" />
			</xsl:variable>
			<xsl:variable name="v_ObjectLogicalName">
				<xsl:value-of select="@logical-name" />
			</xsl:variable>
         <xsl:variable name="v_ClassName">
            <xsl:value-of select="@name" />
         </xsl:variable>
	   <xsl:variable name="v_BaseClassName">
		   <xsl:value-of select="@name" />
		   <xsl:text>Base</xsl:text>
	   </xsl:variable>
	   <xsl:variable name="v_NamespacePrefix">
				<xsl:if test="defaultnamespaceprefix">
					<xsl:value-of select="defaultnamespaceprefix" />
					<xsl:text>:</xsl:text>
				</xsl:if>
         </xsl:variable>
         <xsl:variable name="v_RuntimeNamespace">
				<xsl:if test="ancestor::lzc:project/@defaultnamespace">
					<xsl:value-of select="ancestor::lzc:project/@defaultnamespace"/>
				</xsl:if>
         </xsl:variable>
         <xsl:variable name="v_BusinessConceptNamespace">
				<xsl:if test="/lzc:project/@businessconcept">
					<xsl:text>.</xsl:text>
					<xsl:value-of select="/lzc:project/@businessconcept" />
				</xsl:if>
         </xsl:variable>///***********************************************************************
/// <xsl:value-of select="$v_ClassName" />.cs
/// Owner: joemu
///
/// Provides a .NET Wrapper around the Stored Procedures
/// in the <xsl:value-of select="ancestor::lzc:project/@name" /> database.
///
/// Copyright(c) Microsoft Corporation
///***********************************************************************

using System;
using System.Data;
using System.Data.SqlClient;
using System.Xml;

<xsl:text>
namespace </xsl:text><xsl:value-of select="$v_RuntimeNamespace" /><xsl:text>.DataAccess</xsl:text><xsl:value-of select="$v_BusinessConceptNamespace" /><xsl:text>
{
   public class </xsl:text><xsl:value-of select="$v_ClassName" /> : <xsl:value-of select="$v_RuntimeNamespace" /><xsl:text>.DataAccess</xsl:text><xsl:value-of select="$v_BusinessConceptNamespace" /><xsl:text>.Generated.</xsl:text><xsl:value-of select="$v_BaseClassName" />
   {
      /// &lt;summary&gt;
	  /// Constructs a new <xsl:value-of select="@friendly-name" /> and initializes a new SqlConnection.
	  /// &lt;/summary&gt;
      public <xsl:value-of select="$v_ClassName" />() : base()
      {
      
      }

      /// &lt;summary&gt;
	  /// Constructs a new <xsl:value-of select="@friendly-name" /> initialized with the specified SqlConnection.
	  /// &lt;/summary&gt;
      public <xsl:value-of select="$v_ClassName" />( SqlConnection existingConnection ) : base( existingConnection )
	   {

	   }
	   }
	   }
   </xsl:template>

</xsl:stylesheet>